define(function(require, exports){
	var pubjs = require('pubjs');
	var $ = require('jquery');
	var grid  = require('@base/highGrid');
	// var util = require('util');
	var labels = require('@sys_labels').labels;

	var dealCustomer = grid.base.extend({
		init: function(config){
			config = pubjs.conf(config, {
					url: 'user/overviewDeal',
					param: {
						'IsDeleted': false
						,'Type': 0
						,'order': 'impressions|-1,clicks|-1'
						,'get_all_info': 1
					},
					cols:[
						{name:'UserId',text:LANG("ID"), sort: true, width: 60, align: 'center'}
						,{name:"Name",text: LANG("名称"),render:"renderName",width:210}
						,{name:'DealId',text:LANG("订单ID"), sort: true}
						,{name:"DealName",text: LANG("订单名称"), render:"renderName",width:210}
						,{name:'ChannelName', text:LANG("渠道"), render:"renderName", type:'fixed',width:100}
						,{name:'Price',text:LANG("价格"),type:'fixed', render:"renderPrice"}
					],
					tab: pubjs.config('metricsGroup/overviewDeal/tabs'),
					default_metrics : pubjs.config('metricsGroup/overviewDeal/metrics'),
					reqType: 'websocket',
					hasSwitch: false,
					gridName: 'dealCustomer',
					exportParam: 'user/overviewDeal',
					hasExport: false
				}
			);
			this.Super('init', arguments);
		},
		renderName: function(i, val, data, con){
			val = val || '-';
			return $('<div class="uk-text-truncate tl fl" title="'+val+'">'+val+'</div>').width(con.width-20);
		},
		renderPrice: function(i, val, data) {
			return labels.formatCurrencyKeep2(val);
		}
	});
	exports.base = dealCustomer;

});